package demo6;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-05-27
 * Time: 16:49
 */
class MyThread implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            try {
                Thread.sleep(500);
            }catch (Exception e){

            }
            System.out.println(Thread.currentThread().getName() + "运行，i = " + i);
        }
    }
}
public class ThreadSleepDemo {
    public static void main(String[] args) {
        MyThread mt = new MyThread();
        new Thread(mt, "线程").start();
    }
}
